<?

	session_start();
	
	/*
	function userAppRight($app){
		$appFile ="../../users/".$_SESSION["UserId"]."/$app.app.inc";
		if (file_exists($appFile)) {
		    return true;
		}
	}	
	
	//alredy logged from other portal
	if(!empty($_SESSION["User"])){
		if(empty($_SESSION["UserId"])) {
			$_SESSION["UserId"] = $_SESSION["User"];
			$_SESSION["IsLogged"] = 'yEs' ;
		}	
	}
	
	// check if the user is authenticated
	if (empty($_SESSION["UserId"])||$_SESSION["IsLogged"] != 'yEs') {
	    echo("<pre>Authentication failure");
		print_r($_SESSION);
		exit();
	}
	
	// check the authorization on the request appliaction
	include "../currentapp.inc";
	

	// load user permission
	unset($permission);
	$userFile = "../../users/".$_SESSION["UserId"]."/$currentApp.app.inc";
	// verify if the user has acess to application
	if (!file_exists($userFile)) {
	    echo("<pre>Authentication failure for the $currentApp application file");
		exit();
	}
	require $userFile;
	// include group Permissiom
	include "../user_groups/$usergroup.inc";

	#echo "<pre>group = ";print_r($groupPermission);"\n user = ";print_r($userPermission);

	// override Group setting with user setting
	$permission = array_merge($groupPermission, $userPermission);

	#print_r($permission);echo "</pre>";
	
	
	//------------------------ log

	$fdLogs = array('REMOTE_ADDR','REMOTE_HOST','REQUEST_METHOD','HTTP_REFERER','QUERY_STRING');
	$sLogFile = "d:/ldwcash/logswebapp/log_".date("Ymd").".txt";
	$sLog="";
	// first row
	if (!file_exists($sLogFile) ){
		$sLog .= "Date\tUser";
		foreach($fdLogs as $fd){
			$sLog .= "\t".$fd;
		}
		$sLog .= "\n";
	}

	$sLog .= date("d/m/Y H:i:s");
	$sLog .= "\t".$_SESSION['UserId'];
	foreach($fdLogs as $fd){
		$sLog .= "\t".$_SERVER[$fd];
	}
	$sLog .= "\n";
	$hf=fopen($sLogFile, 'a');
	fwrite($hf, $sLog);	
	fclose($hf);
	
	//------------------------ log end

	*/
?>